--反戈决绝
local fangejuejue = fk.CreateSkill {
    name = "mcdh_fangejuejue",
}

fangejuejue:addEffect('active',{
    card_num = 1,
    target_num = 1,
    card_filter = function(self, to_select, selected)
        local card = Fk:getCardById(to_select)
        return #selected == 0 and (card.trueName == "jink" or card.type == card.TypeEquip) and not Self:prohibitDiscard(card)
    end,
    target_filter = function(self, to_select, selected)
        return #selected == 0 and not Fk:currentRoom():getPlayerById(to_select):isKongcheng() and to_select ~= Self.id
    end,
    can_use = function(self, player)
        return player:usedSkillTimes(self.name,Player.HistoryPhase) == 0
    end,
    on_use = function(self, room, effect)
        local target = room:getPlayerById(effect.tos[1])
        local player = room:getPlayerById(effect.from)
        local card = target:getCardIds("h")
        room:throwCard(effect.cards,self.name,player,player)
        target:showCards(card)
        card =table.filter(card,function(id) return  Fk:getCardById(id).trueName == "slash"  end)
        if #card > 0  then
            room:recastCard(card, target, self.name)
        end
        room:useVirtualCard("duel", nil, player, target, self.name, false)
    end
})

return fangejuejue